﻿using System;
class ReverseDecimalNum
{
    static decimal InputNumber()
    {
        while (true)
        {
            try
            {
                int number = int.Parse(Console.ReadLine());
                return number;
            }
            catch (Exception)
            {
                Console.Write("Please re-enter number: ");
            }
        }
    }
    static decimal ReverseDigits(decimal num)
    {
        string numStr;
        decimal res=0;
        string resStr="";
        numStr = num.ToString();
        for (int i = (numStr.Length - 1); i >= 0; i--)
        {
            resStr = resStr + numStr[i];
        }
        res = decimal.Parse(resStr);
        return res;
    }
    static void Main()
    {
        decimal number = 0;
        decimal result = 0;
        Console.Write("please input decimal number: ");
        number = InputNumber();
        result = ReverseDigits(number);
        Console.Write("the reverset number is: ");
        Console.WriteLine(result);
        Console.ReadLine();
    }
}

